package com.heima.user.controller.v1;

import com.heima.model.common.constants.admin.AdminConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dto.AuthDTO;
import com.heima.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/auth")
@Api(value = "用户审核controller",tags = "用户审核controller")
public class UserController {
    @Autowired
    private UserService userService;

    @ApiModelProperty(value = "查询用户审核界面")
    @PostMapping("/list")
    public ResponseResult getList(@RequestBody AuthDTO dto){
       return userService.getList(dto);

    }

    @ApiOperation("实名认证通过")
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDTO DTO) {
        return userService.updateStatusById(DTO, AdminConstants.PASS_AUTH);
    }


    @ApiOperation("实名认证失败")
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDTO DTO) {
        return userService.updateStatusById(DTO, AdminConstants.FAIL_AUTH);
    }

}
